#include "Item.h"

#include <algorithm>

#include "Character.h"

Item::Item()
: id(0)
, usesLeft(0)
{
}

Item::Item(int id)
: id(id)
{
}

Item::~Item()
{
}

Item& Item::operator=(const Item& rhs)
{ // Don't check for self-assignment since it's probably faster to just do it.
    id = rhs.id;
    usesLeft = rhs.usesLeft;
    return *this;
}

bool operator==(const Item& lhs, const Item& rhs)
{
	return &lhs == &rhs || lhs.id == rhs.id;
}

bool operator<(const Item& lhs, const Item& rhs)
{
    if(lhs.id != rhs.id)
    { // Different items.
        return lhs.id < rhs.id;
    }

    // Same item; compare uses left.
    return lhs.usesLeft < rhs.usesLeft;
}

int Item::getId() const
{
    return id;
}